On Apr 17, 5:38 am, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On Apr 15, 11:31 pm, rajachezh...@gmail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.
some simple example;;; works in ie6,ff2,opera9
...
or---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<style>
#menuTop,#menuTop ul{cursor:default;list-style-type:circle}
#menuTop .m{list-style-type:square}
</style>
<script>
function showHide(elem){
elem=elem.getElementsByTagName("UL")[0]
if(!elem)return;
elem=elem.style;
elem.display=(elem.display!='block')?'block':'none '
}
if(document.createStyleSheet){
var styleSheet=document.createStyleSheet();
styleSheet.addRule("#menuTop ul","display:none")
}else if(document.createElement){
var styleSheet=document.createElement("style")
styleSheet.type="text/css"
styleSheet.textContent="#menuTop ul{display:none}"
document.getElementsByTagName("head")
[0].appendChild(styleSheet)
}
</script>
</head>
<body>
<ul onclick="showHide(event.target||event.srcElement)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>
the document will look good and show all the menus if either
javascript OR css is disabled :)